

module.exports = app => {
    const DataTypes = app.Sequelize;

    const Model = app.model.define('product_type', {
        id: {
            type: DataTypes.INTEGER(8).UNSIGNED,
            allowNull: false,
            primaryKey: true,
            autoIncrement: true
        },
        name: {
            type: DataTypes.STRING(50),
            allowNull: false,
            comment: '类型名称'
        },
        shop_id: {
            type: DataTypes.INTEGER(11),
            allowNull: true,
            defaultValue: null,
            comment: '商家ID，预留SASS功能'
        },
        is_delete: {
            type: DataTypes.INTEGER(1).UNSIGNED,
            allowNull: false,
            defaultValue: '0',
            comment: '是否删除，0->存在，1->删除'
        },
    }, {
        tableName: 'product_type',
        timestamps: false,
        comment: '商品类型'
    });

    Model.sync({ alter: true });

    Model.associate = function () {

    }

    return Model;
};
